package com.sky.edumanageapi.teacher.controller;

import com.sky.edumanageapi.base.response.JsonResult;
import com.sky.edumanageapi.teacher.pojo.dto.TeacherParam;
import com.sky.edumanageapi.teacher.pojo.dto.TeacherQuery;
import com.sky.edumanageapi.teacher.pojo.vo.TeacherVO;
import com.sky.edumanageapi.teacher.service.TeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@Api(tags = "讲师模块")
@RequestMapping("/api/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;

    @ApiOperation(value = "获取讲师列表")
    @GetMapping("/list")
    public JsonResult selectTeacherAll(TeacherQuery teacherQuery) {
        log.debug("查询所有讲师列表:{}", teacherQuery);
        List<TeacherVO> teachername = teacherService.selectTeacher(teacherQuery);
        return JsonResult.ok(teachername);
    }

    @ApiOperation(value = "获取讲师详情")
    @GetMapping("/detail")
    public JsonResult selectTeacherAll(TeacherParam teacherParam) {
        log.debug("查询所有讲师详情:{}", teacherParam);
        List<TeacherVO> teacherall = teacherService.selectTeacherAll(teacherParam);
        return JsonResult.ok(teacherall);
    }


    @ApiOperation(value = "获取讲师列表1")
    @GetMapping("/getList")
    public JsonResult getTeacherList() {
        log.debug("获取讲师列表Controller");
        List<TeacherVO> teacherVOList = teacherService.getTeacherList();
        return JsonResult.ok(teacherVOList);
    }

    @ApiOperation(value = "获取讲师详情1")
    @GetMapping("/getDetail/{id}")
    public JsonResult getTeacherDetail(@PathVariable Integer id) {
        log.debug("获取讲师详情Controller");
        TeacherVO teacherVO = teacherService.getTeacherDetail(id);
        return JsonResult.ok(teacherVO);
    }
}
